package aygx.ip.spring.boot.starter.interceptor;

import aygx.ip.spring.boot.starter.service.IpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author 暗影孤星
 * @date 2022/7/31 23:11
 * @description
 */
public class IpCountInterceptor implements HandlerInterceptor {

    @Autowired
    private IpService ipService;

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        ipService.count();
        return true;
    }
}
